package com.breeze.components.socket;

import lombok.Getter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * socket配置
 *
 * @author breeze
 */
@ConfigurationProperties(prefix = "breeze.websocket")
@Getter
public class WebSocketProperties {

  @Getter private static Boolean isCluster;

  @Getter private static Integer sendTimeLimit;

  @Getter private static Integer bufferSizeLimit;

  @Value("${breeze.websocket.isCluster:false}")
  public void setIsCluster(Boolean isCluster) {
    WebSocketProperties.isCluster = isCluster;
  }

  @Value("${breeze.websocket.setting.sendTimeLimit:10000}")
  public void setSendTimeLimit(Integer sendTimeLimit) {
    WebSocketProperties.sendTimeLimit = sendTimeLimit;
  }

  @Value("${breeze.websocket.setting.bufferSizeLimit:64000}")
  public void setBufferSizeLimit(Integer bufferSizeLimit) {
    WebSocketProperties.bufferSizeLimit = bufferSizeLimit;
  }
}
